/**
 * 初始化-背景动态化
 */
$(function(){
	$(".screenbg ul li").each(function(){
		$(this).css("opacity","0");
	});
	$(".screenbg ul li:first").css("opacity","1");
	var index = 0;
	var t;
	var li = $(".screenbg ul li");	
	var number = li.size();
	function change(index){
		li.css("visibility","visible");
		li.eq(index).siblings().animate({opacity:0},3000);
		li.eq(index).animate({opacity:1},3000);
	}
	function show(){
		index = index + 1;
		if(index<=number-1){
			change(index);
		}else{
			index = 0;
			change(index);
		}
	}
	t = setInterval(show,8000);
	//根据窗口宽度生成图片宽度
	var width = $(window).width();
	$(".screenbg ul img").css("width",width+"px");
	
	$("#loginButton").attr("onclick" ,"login()");
});

/**
 * 用户登陆
 */
function login() {
	var loginForm=$('#loginForm').form();
	  $.post('login/toLogin',$.serializeObject(loginForm), function(data) {
          if (data.code ==0){
        	  window.location.href="login/wecome";
              window.location = data.obj;//操作结果提示
          }else {
              
          }
      }, 'json');
	
}



